package cu.tedu.egmvc3.controller;

import cu.tedu.egmvc3.mapper.EmpMapper;
import cu.tedu.egmvc3.pojo.dto.EmpDTO;
import cu.tedu.egmvc3.pojo.entity.Emp;
import cu.tedu.egmvc3.pojo.vo.EmpVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/emp/")
public class EmpController {

    @Autowired
    private EmpMapper empMapper;
    @RequestMapping("insert")
    public String insert(EmpDTO empDTO){
        return "添加成功"+empMapper.insert(empDTO);
    }
    @RequestMapping("select")
    public List<EmpVO> select(EmpVO empVO){

        return empMapper.select(empVO);
    }

    @RequestMapping("update")
    public String update(Emp emp){
        return "修改成功"+empMapper.update(emp);
    }

    @RequestMapping("delete")
    public String delete(int id){
        return "删除成功"+empMapper.delete(id);
    }
}
